#include <stdio.h>
#include <unistd.h>
#include <string.h>

#define RED "\033[0;32;31m""]"
#define NONE "\033[0m""]"
#define GREEN "\033[0;32;32m""]"
#define BLUE "\033[0;32;34m""]"
#define YELLOW "\033[1;33m""]"

int main()
{
      char bar[101];
        int i = 0;
          const char* p = "-/|\\";
            memset(bar, 0, sizeof(bar));
            while(i <= 100){
                if(i % 4 == 0){
                          printf(YELLOW);
                              
                }else if(i % 4 == 1){
                          printf(GREEN);
                              
                }else if(i % 4 == 2){
                          printf(BLUE);
                              
                }else{
                          printf(RED);
                              
                }
                    printf("[%-100s][%d%%][%c]\r",bar, i, *(p + (i % 4)));
                        fflush(stdout);
                            bar[i++] = '#';
                                usleep(100000); 
                                  
            }
              printf(NONE);
                printf("\n");
                
                  return 0;
}
